package com.wc.alorithm_luogu.P1420;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/20 12:31
 * @description https://www.luogu.com.cn/problem/P1420
 * 最长连号
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        // 当前最大长度
        int ans = 1;
        // 前一个数字
        int preNum = sc.nextInt();
        // 当前数字
        int curNum;
        // 当前长度
        int curLength = 1;

        while (--n > 0) {
            curNum = sc.nextInt();
            if (curNum == preNum + 1) {
                curLength++;
                ans = Math.max(ans, curLength);
            } else {
                curLength = 1;
            }
            preNum = curNum;
        }
        ans = Math.max(ans, curLength);
        System.out.println(ans);
    }
}
